﻿using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using OpenAdmin.Core.DbContextLocators;

namespace OpenAdmin.Core.Models;

/// <summary>
/// 角色表
/// </summary>
[Table("SysRole")]
public class SysRole : TenantEntityBase<ApplicationDbContextLocator>, IEntityTypeConfigure<SysRole>
{
    /// <summary>
    /// 角色名
    /// </summary>
    public string Name { get; set; }
    /// <summary>
    /// 是否激活
    /// </summary>
    public bool Enabled { get; set; }

    public void Configure(EntityTypeBuilder<SysRole> entityBuilder)
    {
        entityBuilder.Property(p => p.Name).HasMaxLength(50).IsRequired();
    }
}
